#root {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
  filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  a:nth-of-type(2) .logo {
    animation: logo-spin infinite 20s linear;
  }
}

.card {
  padding: 3em;
}

.read-the-docs {
  color: #888;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  max-width: 600px;
}

@media (max-width: 768px) {
  .game-board {
    gap: 8px;
    padding: 12px;
  }
  
  .card {
    min-width: 15vw;
    min-height: 15vw;
  }
}

/* 新增卡片翻转动画 */
.card {
  perspective: 1000px;
  position: relative;
  transform: translateZ(0);
  transform-origin: center;
  will-change: transform;
}

.card.selected {
  z-index: 3;
  transform: scale(1.05) translateZ(0);
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 3px solid #FFD700;
  margin: -3px;
}

.card-inner {
  position: relative;
  z-index: 1;
}

.card.flipped .card-inner {
  z-index: 3;
}



.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  transform-origin: center;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 12px;
  transform-style: preserve-3d;
}

/* 更新卡片样式 */
.card-front {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  font-size: 1.4em;
}

.card-back {
  background: linear-gradient(45deg, #2196F3, #1976D2);
  font-size: 1.4em;
}

/* 添加悬停动画 */
.card:not(.matched):hover .card-inner {
  transform: scale(1.05);
}

/* 调整网格列数适配移动端 */
.game-board {
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.card {
  aspect-ratio: 1;
  min-width: 50px;
  min-height: 50px;
  overflow: hidden;
}

.card-front,
.card-back {
  font-size: 0.8em;
  word-break: break-word;
}

/* 优化卡片悬停效果 */
.card:not(.matched):hover {
  z-index: 2;
  transform: scale(1.02) translateZ(0);
}

/* 统一卡片过渡动画 */
.card {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 调整卡片内边距 */
.card-front,
.card-back {
  padding: 3px;
}

/* 优化内容居中 */
.card-front,
.card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px !important;
  font-size: 1em;
}

/* 更新卡片背景色 */
.card-front {
  background: linear-gradient(45deg, #FFB74D, #FFA726);
  color: #2c3e50;
}

.card-back {
  background: linear-gradient(45deg, #81C784, #66BB6A);
  color: #ffffff;
}

/* 增强匹配动画 */
@keyframes coinFall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(1);
    opacity: 1;
    filter: brightness(1.5) drop-shadow(0 0 5px gold);
  }
  50% {
    transform: translateY(50vh) rotate(1080deg) scale(1.2);
  }
  100% {
    transform: translateY(100vh) rotate(2160deg) scale(0.8);
    opacity: 0;
  }
}

.coin {
  position: absolute;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 30% 30%, #FFD700 10%, #FFA500 90%);
  border-radius: 50%;
  animation: coinFall 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  z-index: 999;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.treasure-bowl {
  position: fixed;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 200px;
  background: url('treasure-bowl.png') no-repeat center/contain;
  filter: drop-shadow(0 10px 20px rgba(255, 215, 0, 0.3));
  z-index: 900;
}

.coins-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 120%, rgba(255, 215, 0, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes matchAnimation {
  0% {
    transform: scale(1);
    opacity: 1;
    }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
    }
  100% {
    transform: scale(0);
    opacity: 0;
    }
}

.matched {
  animation: matchAnimation 0.8s ease-out forwards;
  position: relative;
  overflow: visible;
}

.matched::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255,215,0,0.8);
  border-radius: 50%;
  animation: particle 0.6s ease-out;
}

@keyframes particle {
  0% {
    transform: translate(0,0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(0);
    opacity: 0;
  }
}
.read-the-docs {
  color: #888;
}

/* 新增选中状态样式 */


.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}
.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}

.read-the-docs {
  color: #888;
}



.game-board {
  place-items: center;
  grid-auto-rows: minmax(40px, auto);
}

.read-the-docs {
  color: #888;
}

/* 修正桌面端网格布局 */
.game-board {
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.card {
  min-width: 80px;
  min-height: 80px;
}

.card-front,
.card-back {
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  line-height: 1.4;
  padding: 8px;
}

.read-the-docs {
  color: #888;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 768px) {
  .game-board {
    gap: 8px;
  }
}

/* 新增卡片翻转动画 */
.card {
  perspective: 1000px;
  position: relative;
}

.card-inner {
  position: relative;
  z-index: 1;
}

.card.flipped .card-inner {
  z-index: 3;
}



.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  transform-origin: center;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 12px;
  transform-style: preserve-3d;
}

/* 更新卡片样式 */
.card-front {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  font-size: 1.4em;
}

.card-back {
  background: linear-gradient(45deg, #2196F3, #1976D2);
  font-size: 1.4em;
}

/* 添加悬停动画 */
.card:not(.matched):hover .card-inner {
  transform: scale(1.05);
}

/* 调整网格列数适配移动端 */
.game-board {
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.card {
  aspect-ratio: 1;
  min-width: 50px;
  min-height: 50px;
  overflow: hidden;
}

.card-front,
.card-back {
  font-size: 0.8em;
  word-break: break-word;
}

/* 优化卡片悬停效果 */
.card:not(.matched):hover {
  z-index: 2;
  transform: scale(1.02) translateZ(0);
}

/* 统一卡片过渡动画 */
.card {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 调整卡片内边距 */
.card-front,
.card-back {
  padding: 3px;
}

/* 优化内容居中 */
.card-front,
.card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  font-size: 1em;
}

/* 更新卡片背景色 */
.card-front {
  background: linear-gradient(45deg, #FFB74D, #FFA726);
  color: #2c3e50;
}

.card-back {
  background: linear-gradient(45deg, #81C784, #66BB6A);
  color: #ffffff;
}

/* 增强匹配动画 */
@keyframes coinFall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(1);
    opacity: 1;
    filter: brightness(1.5) drop-shadow(0 0 5px gold);
  }
  50% {
    transform: translateY(50vh) rotate(1080deg) scale(1.2);
  }
  100% {
    transform: translateY(100vh) rotate(2160deg) scale(0.8);
    opacity: 0;
  }
}

.coin {
  position: absolute;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 30% 30%, #FFD700 10%, #FFA500 90%);
  border-radius: 50%;
  animation: coinFall 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  z-index: 999;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.treasure-bowl {
  position: fixed;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 200px;
  background: url('treasure-bowl.png') no-repeat center/contain;
  filter: drop-shadow(0 10px 20px rgba(255, 215, 0, 0.3));
  z-index: 900;
}

.coins-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 120%, rgba(255, 215, 0, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes matchAnimation {
  0% {
    transform: scale(1);
    opacity: 1;
    }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
    }
  100% {
    transform: scale(0);
    opacity: 0;
    }
}

.matched {
  animation: matchAnimation 0.8s ease-out forwards;
  position: relative;
  overflow: visible;
}

.matched::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255,215,0,0.8);
  border-radius: 50%;
  animation: particle 0.6s ease-out;
}

@keyframes particle {
  0% {
    transform: translate(0,0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(0);
    opacity: 0;
  }
}
.read-the-docs {
  color: #888;
}

/* 新增选中状态样式 */


.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}
.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}

.read-the-docs {
  color: #888;
}



.game-board {
  place-items: center;
  grid-auto-rows: minmax(40px, auto);
}

.read-the-docs {
  color: #888;
}


.card.math-card .card-front {
  background: linear-gradient(45deg, #FF6B6B, #FF5252);
  position: relative;
}

.card.math-card .card-front::after {
  content: '∑';
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 0.8em;
  opacity: 0.6;
}

.card.math-card .card-back {
  background: linear-gradient(45deg, #4ECDC4, #45B7AF);
}

/* 更新普通卡片样式 */
.card-front {
  background: linear-gradient(45deg, #FFB74D, #FFA726);
}

.card-back {
  background: linear-gradient(45deg, #81C784, #66BB6A);
}

.read-the-docs {
  color: #888;
}



.game-board {
  place-items: center;
  grid-auto-rows: minmax(40px, auto);
}

.read-the-docs {
  color: #888;
}


.win-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #FFD700 0%, #FFA500 100%);
  padding: 2rem 3rem;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
  border: 3px solid #FFD700;
  z-index: 1000;
}

.coins-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.confirm-button {
  background: #FFD700;
  color: #2c2c2c;
  border: none;
  padding: 10px 25px;
  border-radius: 25px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.confirm-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px #FFD700;
}
.read-the-docs {
  color: #888;
}

/* 新增选中状态样式 */


.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}
.card.selected .card-inner {
  box-shadow: 0 0 15px #ffd700;
  transition: all 0.2s ease-in-out;
}

.read-the-docs {
  color: #888;
}



.game-board {
  place-items: center;
  grid-auto-rows: minmax(40px, auto);
}

.read-the-docs {
  color: #888;
}

.card.poem-card .card-back {
  background-image: url('treasure-bowl.png');
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 18px;
  line-height: 1.8;
  padding: 10px;
  background-size: cover;
  color: #654321;
}

.matched.poem-card {
  border: 2px solid #8b4513;
}
